/**
 * 
 */
package cn.owen.task;

import org.springframework.stereotype.Component;

/**定时任务 更新文章详情页文章链接
 * @author Burning
 * @email wenbao163.good@163.com
 * @date 2016年12月15日下午8:48:26
 * 
 */
@Component
public class ScheduledTasks {
	/*private static final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
	 @Autowired
	 private ArticleService articleService;
	*//**
	 *  @Scheduled(fixedRate = 5000) 每五秒
	 *  @Scheduled(cron = "0 0 2 * * ?") 每天凌晨2点
	 *//*
	@Scheduled(cron = "0 0 2 * * ?")
    public void reportCurrentTime() {
        List<ArticleVo> avs=new ArrayList<ArticleVo>();
        avs=articleService.selectUsefullArticles();
        for(ArticleVo av:avs){
        	List<ArticleVo> arlist;
        	String newName=articleService.selectNewNameByName(av.getId());
        	if(newName!=null&&newName!=""&&!newName.equals("")){
        		av.setName(newName);
        	}
        	arlist=articleService.selectArticleByTitle(av.getName());
        	for(ArticleVo arv:arlist){
        		String content=arv.getName();
        		Integer id=av.getId();
        		String enid;
				try {
					enid = DesEncryption.encrypt(id.toString());
					content=content.replace("<a th:href=\"/font/detail?id="+enid+">"+"<a th:href=\"/font/detail?id="+enid+"\">"+av.getName()+"</a>"+"</a>", av.getName());
					content=content.replace("<a th:href=\"/font/detail?id="+enid+"\">"+av.getName()+"</a>", av.getName());
					content=content.replace("<a href=\"/font/detail?id="+enid+"\">"+av.getName()+"</a>", av.getName());
					content=content.replace(av.getName(), "<a href=\"/font/detail?id="+enid+"\">"+av.getName()+"</a>");
					Map map=new HashMap();
					map.put("id", arv.getId());
					map.put("content", content);
					articleService.updateArticleContent(map);
				} catch (Exception e) {
					e.printStackTrace();
				}
        	}
        }
        
    }*/
}
